package com.jial08.designpatterns.proxy.impl;

import com.jial08.designpatterns.proxy.Image;

/**
 * <p>类描述：代理读取文件类。</p>
 *
 * @author jl
 * @version v1.0.0.1。
 * @since JDK1.8。
 * <p>创建日期：2019/10/18 上午9:15。</p>
 */
public class ProxyImage implements Image {
	private String fileName;
	private RealImage realImage;

	public ProxyImage(String fileName) {
		this.fileName = fileName;
	}

	@Override
	public void display() {
		if (realImage == null) {
			realImage = new RealImage(fileName);
		}
		realImage.display();
	}
}
